import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/login',
        name: 'login',
        component:()=>import('../views/Login.vue')
    },
    {
        path: '/',
        name: 'layout',
        component: ()=>import('../layout/IndexLayout.vue'),
        redirect:'/home',
        children:[
            {
                path: '/home',
                name: 'home',
                component:HomeView,
                meta: { title: '首页'}
            },
            {
                path: '/about',
                name: 'about',
                component: () => import('../views/AboutView.vue')
            },
            {
                path: '/category',
                name: 'Category',
                component: () => import('../views/Category.vue')
            },
            {
                path: '/product',
                name: 'Product',
                component: () => import('../views/Product.vue')
            },
            {
                path: 'system/user',
                name:'user',
                component: ()=>import('../views/SystemUser.vue')
            },
            {
                path: 'sale/order',
                name: 'SaleOrder',
                component: ()=>import('../views/SaleOrder.vue')
            },
            {
                path: 'sale/payment',
                name:'Payment',
                component: ()=>import('../views/PaymentView.vue')
            }

        ]
    },
]

const router = new VueRouter({
    // mode指定为history，用于去掉访问路径中的#
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
